package com.vietnam.power.util;

import org.springframework.context.i18n.LocaleContextHolder;

import com.ckeditor.CKEditorConfig;

public class CKConfiguration {
	public static CKEditorConfig createConfig() {
		CKEditorConfig config = new CKEditorConfig();
		config.addConfigValue(
				"toolbar",
				"["
						+ "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },"
						+ "{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },"
						+ "{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },"
						+ "{ name: 'insert', items : [ 'Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },"
						+ "{ name: 'colors', items : [ 'TextColor','BGColor' ] },"
						+ "{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }]");
		
		config.addConfigValue("language", LocaleContextHolder.getLocale().getLanguage());
		config.addConfigValue("basicEntities", false);
		config.addConfigValue("htmlEncodeOutput", false);
		config.addConfigValue("entities", false);
		return config;
	}

	public static CKEditorConfig createFullConfig() {
		CKEditorConfig config = new CKEditorConfig();
		config.addConfigValue(
				"toolbar",
				"["
						+ "{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },"
						+ "{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, "
						+ "{ name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },"
						+ "{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },"
						+ "{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },"
						+ "{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },"
						+ "{ name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },'/',"
						+ "{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }," + "{ name: 'colors', items : [ 'TextColor','BGColor' ] },"
						+ "{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }]");
		
		config.addConfigValue("language", LocaleContextHolder.getLocale().getLanguage());
		config.addConfigValue("basicEntities", false);
		config.addConfigValue("htmlEncodeOutput", false);
		config.addConfigValue("entities", false);
		return config;
	}
}
